home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / business / nonlin18.zip / NONLIN.DOC < prev    next >
Text File  |  1992-10-18  |  96KB  |  1,883 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                                     N O N L I N
  11.  
  12.  
  13.  
  14.                        Nonlinear Regression Analysis Program
  15.  
  16.  
  17.  
  18.  
  19.                                 Phillip H. Sherrod
  20.  
  21.                                A "shareware" program
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.               Nonlin  allows  you  to  perform statistical regression
  29.               analyses to  estimate  the  values  of  parameters  for
  30.               linear, multivariate, polynomial, and general nonlinear
  31.               functions.   The  regression  analysis  determines  the
  32.               values of the parameters which cause  the  function  to
  33.               best fit  the  observed  data that you provide.  Nonlin
  34.               allows you to specify the function whose parameters are
  35.               being estimated using ordinary algebraic notation.   In
  36.               addition to determining the parameter estimates, Nonlin
  37.               can  be  directed  to  generate  an  output  file  with
  38.               predicted values and residuals.  It can also  plot  the
  39.               data observations  and the computed function.  Although
  40.               designed for regression analysis, Nonlin  can  also  be
  41.               used  to find the root (zero point) or minimum absolute
  42.               value of a nonlinear expression.  Nonlin is in  use  at
  43.               many engineering and research centers around the world.
  44.  
  45.                 NONLIN -- Nonlinear Regression Program       Page 1
  46.  
  47.  
  48.  
  49.  
  50.          INTRODUCTION TO REGRESSION ANALYSIS
  51.  
  52.          The goal of regression analysis is to  determine  the  values  of
  53.          parameters  for  a function that cause the function to best fit a
  54.          set of data observations that you provide.  In linear regression,
  55.          the function is a linear (straight line) equation.  For  example,
  56.          if  we  assume the value of an automobile decreases by a constant
  57.          amount each year after its purchase, and for  each  mile  driven,
  58.          the  following  linear  function  would  predict  its  value (the
  59.          dependent  variable)  as  a  function  of  the  two   independent
  60.          variables which are age and miles:
  61.  
  62.          value = price + depage*age + depmiles*miles
  63.  
  64.          where  `value',  the dependent variable, is the value of the car,
  65.          `age' is the age of the car, and `miles' is the number  of  miles
  66.          that the car has been driven.
  67.  
  68.          The  regression  analysis  performed by Nonlin will determine the
  69.          best values of the three parameters, `price', the estimated value
  70.          when age is 0  (i.e.,  when  the  car  was  new),  `depage',  the
  71.          depreciation  that  takes  place  each  year, and `depmiles', the
  72.          depreciation for each mile driven.  The values  of  `depage'  and
  73.          `depmiles'  will  be  negative because the car loses value as age
  74.          and miles increase.
  75.  
  76.          In a problem such as this  car  depreciation  example,  you  must
  77.          provide  a  data  file containing the values of the dependent and
  78.          independent variables for a set of observations.  In this example
  79.          each observation record would contain three numbers: value,  age,
  80.          and  miles,  collected  from used car ads for the same model car.
  81.          The more observations you provide, the more accurate will be  the
  82.          estimate of the parameters.
  83.  
  84.          The Nonlin commands to perform this regression are shown below:
  85.  
  86.              VARIABLES VALUE,AGE,MILES
  87.              PARAMETERS PRICE,DEPAGE,DEPMILES
  88.              FUNCTION VALUE = PRICE + DEPAGE*AGE + DEPMILES*MILES
  89.              DATA
  90.              (data values go here)
  91.  
  92.          Once  the  values of the parameters are determined by Nonlin, you
  93.          can use the formula to predict the value of a car  based  on  its
  94.          age and miles driven.  For example, if Nonlin computed a value of
  95.          16000  for  price, -1000 for depage, and -0.15 for depmiles, then
  96.          the function
  97.  
  98.          value = 16000 - 1000*age - 0.15*miles
  99.  
  100.                NONLIN -- Nonlinear Regression Program       Page 2
  101.  
  102.  
  103.          could be used to estimate the value of a car with a known age and
  104.          number of miles.
  105.  
  106.          If  a  perfect  fit  existed  between the function and the actual
  107.          data, the actual value of  each  car  in  your  data  file  would
  108.          exactly equal  the  predicted value.  Typically, however, this is
  109.          not the case, and the difference between the actual value of  the
  110.          dependent  variable  and  its  predicted  value  for a particular
  111.          observation is the error of the estimate which is  known  as  the
  112.          "deviation" or "residual".  The goal of regression analysis is to
  113.          determine  the values of the parameters which minimize the sum of
  114.          the squared residual values for the set of observations.  This is
  115.          known as a "least squares" regression fit.
  116.  
  117.  
  118.          INTRODUCTION TO NONLIN
  119.  
  120.          Nonlin is a very powerful regression analysis program.  Using  it
  121.          you  can  perform  multivariate,  linear, polynomial, and general
  122.          nonlinear regression.  What this means is that  you  specify  the
  123.          form  of  the function to be fitted to the data, and the function
  124.          can include nonlinear terms such as variables  raised  to  powers
  125.          and  library  functions  such  as  log,  exponential,  sine, etc.
  126.          Nonlin uses a state-of-the-art regression algorithm that works as
  127.          well, or better, than any you are likely to  find  in  commercial
  128.          statistical packages.
  129.  
  130.          As   an   example   of  nonlinear  regression,  consider  another
  131.          depreciation problem.  The value of a used airplane decreases for
  132.          each year of its age.  Assuming the value of a plane falls by the
  133.          same amount each year, a linear function relating  value  to  age
  134.          is:
  135.  
  136.               Value = p0 + p1*Age
  137.  
  138.          Where  `p0'  and  `p1'  are the parameters whose values are to be
  139.          determined.  However, it is a well known fact  that  planes  (and
  140.          automobiles)  lose more value the first year than the second, and
  141.          more the second than the third, etc.  This means  that  a  linear
  142.          (straight  line) function cannot accurately model this situation.
  143.          A better, nonlinear, function is:
  144.  
  145.               Value = p0 + p1*exp(-p2*Age)
  146.  
  147.          Where the `exp' function is the value of e (2.7182818...)  raised
  148.          to a  power.    This  type  of  function  is  known  as "negative
  149.          exponential" and is appropriate for modeling a value  whose  rate
  150.          of  decrease  is proportional to the difference between the value
  151.          and some base value.  The F33YEAR.NLR example command file fits a
  152.          linear function to the value of used airplanes.   The  F33EXP.NLR
  153.          example  fits  a  negative exponential function to the same data.
  154.          Run both examples and compare the fitted functions.  See  F33.NLR
  155.          for  an  example of a multiple regression using three independent
  156.  
  157.                NONLIN -- Nonlinear Regression Program       Page 3
  158.  
  159.  
  160.          variables.
  161.  
  162.          Much  of  the  convenience of Nonlin comes from the fact that you
  163.          can  enter  complicated  functions   using   ordinary   algebraic
  164.          notation.   Examples of functions that can be handled with Nonlin
  165.          include:
  166.  
  167.          Linear: Y = p0 + p1*X
  168.  
  169.          Quadratic: Y = p0 + p1*X + p2*X^2
  170.  
  171.          Multivariate: Y = p0 + p1*X + p2*Z + p3*X*Z
  172.  
  173.          Exponential: Y = p0 + p1*exp(X)
  174.  
  175.          Periodic: Y = p0 + p1*sin(p2*X)
  176.  
  177.          Misc: Y = p0 + p1*Y + p2*exp(Y) + p3*sin(Z)
  178.  
  179.          In other words, the function is a  general  expression  involving
  180.          one  dependent  variable  (on the left of the equal sign), one or
  181.          more independent variables, and  one  or  more  parameters  whose
  182.          values are to be estimated.
  183.  
  184.          Because  of  its  generality,  Nonlin  can  perform  all  of  the
  185.          regressions handled by ordinary linear or multivariate regression
  186.          programs as well as nonlinear regression.  However, in  order  to
  187.          handle  nonlinear  functions,  Nonlin  uses an iterative function
  188.          optimization algorithm which is slower  than  the  simple  linear
  189.          regression  algorithm and has the potential for not converging to
  190.          a solution.
  191.  
  192.  
  193.          INSTALLING NONLIN
  194.  
  195.          The NONLIN system consists of the following files:
  196.  
  197.            NONLIN.EXE -- The executable program.
  198.            NONLIN.DOC -- Documentation file.
  199.            NONLIN.FON -- Font file used if you request a plot.
  200.            NONLIN.LJF -- HP LaserJet font file used if you print a plot.
  201.                 *.NLR -- Example command files.
  202.          REGISTER.DOC -- Form used to register your use of Nonlin.
  203.  
  204.          To install Nonlin, copy the files  into  the  directory  of  your
  205.          choice.   If  you do not plan to generated hard copy output for a
  206.          LaserJet printer, you may delete the NONLIN.LJF  file.    If  the
  207.          NONLIN.FON   and   NONLIN.LJF  files  are  not  in  your  current
  208.          directory, you must place a command of the following form in your
  209.          AUTOEXEC.BAT file to tell Nonlin  where  to  look  for  its  font
  210.          files:
  211.  
  212.                 NONLIN -- Nonlinear Regression Program       Page 4
  213.  
  214.  
  215.          SET NONLIN=directory
  216.  
  217.          Where "directory" is the name of the device and  directory  where
  218.          the files  are located.  For example, if the files are located in
  219.          a directory named NONLIN on the C  disk,  the  following  command
  220.          could be used:
  221.  
  222.          SET NONLIN=C:\NONLIN
  223.  
  224.  
  225.          USING NONLIN
  226.  
  227.          Once  Nonlin  has  been  installed, it can be started using a DOS
  228.          command of the form:
  229.  
  230.          NONLIN command_file [listing_file]
  231.  
  232.          where "command_file" is the name  of  a  file  containing  Nonlin
  233.          commands that  control  the  analysis.   The sections that follow
  234.          describe these commands.  If you  specify  a  command  file  name
  235.          without  an  extension,  ".NLR" is used as the default extension.
  236.          If you omit the command file name, Nonlin prints a  list  of  its
  237.          commands.
  238.  
  239.          A  "listing_file" parameter may be specified on the command line.
  240.          If  you  specify  a  file  name,  the  output  (results)  of  the
  241.          regression analysis are written to this file.  If no file name is
  242.          specified,  the output is written to a file with the same name as
  243.          the command_file but with the extension ".LST".  If you specify a
  244.          listing file name without an extension, ".LST" is provided as the
  245.          default extension.  Specify NUL for the listing_file  if  you  do
  246.          not want to generate an output file.
  247.  
  248.          For   example,  to  process  a  command  file  named  LINEAR.NLR,
  249.          directing output to a file named LINEAR.LST,  use  the  following
  250.          command:
  251.  
  252.          NONLIN LINEAR
  253.  
  254.          To  do  the  same  analysis, directing the output to a file named
  255.          MODEL1.LST, use the following command:
  256.  
  257.          NONLIN LINEAR MODEL1
  258.  
  259.          At this point, I suggest  you  pause  in  your  reading  and  try
  260.          running a Nonlin example to get a feel for how it works.  Several
  261.          example  files  with  the  extension ".NLR" are provided with the
  262.          distribution.  LINEAR.NLR is a good one to start with.  If you do
  263.          not have a graphics monitor, edit  the  LINEAR.NLR  command  file
  264.          (and other example files) and remove the PLOT command.
  265.  
  266.                 NONLIN -- Nonlinear Regression Program       Page 5
  267.  
  268.  
  269.          FUNCTION SPECIFICATION
  270.  
  271.          Much of the power of Nonlin comes from its  ability  to  estimate
  272.          the  value  of  parameters that are part of complicated functions
  273.          that you enter in ordinary algebraic form.  This section explains
  274.          the arithmetic operators and built in functions that are used  to
  275.          specify a function.
  276.  
  277.          Arithmetic Operators
  278.  
  279.          The following arithmetic operators may be used in expressions:
  280.  
  281.              +        addition
  282.              -        subtraction or unary minus
  283.              *        multiplication
  284.              /        division
  285.              ** or ^  exponentiation
  286.  
  287.          Exponentiation   has   the   highest   precedence,   followed  by
  288.          multiplication and division, and then addition  and  subtraction.
  289.          Parentheses may be used to group terms.
  290.  
  291.          As  a  convenience,  Nonlin allows you to omit the multiplication
  292.          operator between a numeric constant  and  a  following  variable,
  293.          parameter, or  function.  For example, the expressions "2pi", and
  294.          "2 pi" are equivalent to "2*pi".  Similarly, "5X"  is  equivalent
  295.          to "5*X".    However,  if  you specify a number before the letter
  296.          "E", it will be taken as the exponential form of  a  number  (see
  297.          below)  rather  than  the  number  times  the constant e (base of
  298.          natural logarithms).
  299.  
  300.          Numeric Constants
  301.  
  302.          Numeric constants may be written in their  natural  form  (1,  0,
  303.          1.5,  .0003, etc.) or in exponential form, n.nnnEppp, where n.nnn
  304.          is the base value and ppp is the power of ten by which  the  base
  305.          is multiplied.    For  example, the number 1.5E4 is equivalent to
  306.          15000.  All numbers  are  treated  as  "floating  point"  values,
  307.          regardless of  whether a decimal point is specified or not.  As a
  308.          convenience for entering time values, if a value contains one  or
  309.          more  colons,  the portion to the left of the colon is multiplied
  310.          by 60.  For  example,  1:00  is  equivalent  to  60;  1:00:00  is
  311.          equivalent to 3600.
  312.  
  313.          Symbolic Constants
  314.  
  315.          You can use the CONSTANT command to associate symbolic names with
  316.          constant numeric  values.   When you use the symbolic name in the
  317.          function the numeric value is substituted for the symbolic name.
  318.  
  319.                NONLIN -- Nonlinear Regression Program       Page 6
  320.  
  321.  
  322.          Built-in Constants
  323.  
  324.          There  are  two  built-in numeric constants that may be specified
  325.          using symbolic names.  The symbolic name "PI"  is  equivalent  to
  326.          the value of pi, 3.14159...  Similarly, the symbolic constant "E"
  327.          is  equivalent to the base of natural logarithms, e, 2.7182818...
  328.          You may write PI and E using either upper or lower case.
  329.  
  330.  
  331.          Built in Functions
  332.  
  333.          The following functions are built into Nonlin and may be used  in
  334.          expressions:
  335.  
  336.          ABS(x) -- Absolute value of x.
  337.  
  338.          ACOS(x) -- Arc cosine of x.  Angles are measured in radians.
  339.  
  340.          ASIN(x) -- Arc sine of x.  Angles are measured in radians.
  341.  
  342.          ATAN(x) -- Arc tangent of x.  Angles are measured in radians.
  343.  
  344.          BETAI(x,a,b) --   Incomplete   beta   function:   Ix(a,b).    The
  345.               incomplete beta function can be used to compute a variety of
  346.               statistical functions.   For  example,  the  probability  of
  347.               Student's  t  with  `df'  degrees of freedom can be computed
  348.               with BETAI(df/(df+t^2),.5*df,.5).  The probability of the  F
  349.               statistic  with  df1  and  df2  degrees  of  freedom  can be
  350.               computed with 2*BETAI(df2/(df2+df1*f),.5*df2,.5*df1).
  351.  
  352.          COS(x) -- Cosine of x.  Angles are measured in radians.
  353.  
  354.          COSH(x) -- Hyperbolic cosine of x.
  355.  
  356.          COT(x) -- Cotangent of x. (COT(x) = 1/TAN(x)).  Angle in radians.
  357.  
  358.          CSC(X) -- Cosecant of x. (CSC(x) = 1/SIN(x)).  Angle in radians.
  359.  
  360.          DEG(x) -- Converts an  angle,  x,  measured  in  radians  to  the
  361.               equivalent number of degrees.
  362.  
  363.          EI1(alpha,phi) --  Elliptic integral of the first kind.  Computes
  364.               the  integral  from  0  to  phi  radians  of  the   function
  365.               d.phi/sqrt(1-k**2*sin(phi)**2),  where k = sin(alpha). alpha
  366.               and phi must be in the range 0 to pi/2.
  367.  
  368.          EI2(alpha,phi) -- Elliptic integral of the second kind.  Computes
  369.               the  integral  from  0  to  phi  radians  of  the   function
  370.               sqrt(1-k**2*sin(phi)**2)*d.phi,  where k = sin(alpha). alpha
  371.               and phi must be in the range 0 to pi/2.
  372.  
  373.                 NONLIN -- Nonlinear Regression Program       Page 7
  374.  
  375.  
  376.          EIC1(alpha) -- Complete elliptic  integral  of  the  first  kind.
  377.               Computes the integral from 0 to pi/2 radians of the function
  378.               d.phi/sqrt(1-k**2*sin(phi)**2), where k = sin(alpha).  alpha
  379.               must be in the range 0 to (less than) pi/2.
  380.  
  381.          EIC2(alpha)  --  Complete  elliptic  integral of the second kind.
  382.               Computes the integral from 0 to pi/2 radians of the function
  383.               sqrt(1-k**2*sin(phi)**2)*d.phi, where k = sin(alpha).  alpha
  384.               must be in the range 0 to pi/2.
  385.  
  386.          ERF(x) -- Standard error function of x.
  387.  
  388.          EXP(x) -- e (base of natural logarithms) raised to the x power.
  389.  
  390.          FAC(x) --  x  factorial (x!).  Note, the FAC function is computed
  391.               using the GAMMA function (FAC(x)=GAMMA(x+1)) so  non-integer
  392.               argument values may be computed.
  393.  
  394.          GAMMA(x) -- Gamma function.  Note, GAMMA(x+1) = x! (x factorial).
  395.  
  396.          GAMMAI(x)   --   Reciprocal   of   GAMMA  function  (GAMMAI(x)  =
  397.               1/GAMMA(x)).
  398.  
  399.          GAMMALN(x) -- Log (base e) of the GAMMA function.
  400.  
  401.          HAV(x) -- Haversine of  x.  (HAV(x) = (1-COS(x))/2).    Angle  in
  402.               radians.
  403.  
  404.          J0(x) -- Bessel function of the first kind, order zero.
  405.  
  406.          J1(x) -- Bessel function of the first kind, order one.
  407.  
  408.          JN(n,x) -- Bessel function of the first kind, order n.
  409.  
  410.          LOG(x) -- Natural logarithm of x.
  411.  
  412.          LOG10(x) -- Base 10 logarithm of x.
  413.  
  414.          LOG2(x) -- Base 2 logarithm of x.
  415.  
  416.          MAX(x1,x2) -- Maximum value of x1 or x2.
  417.  
  418.          MIN(x1,x2) -- Minimum value of x1 or x2.
  419.  
  420.          NORMAL(x) -- Normal probability distribution of x.  X is in units
  421.               of standard  deviations  from  the  mean.   See also the NPD
  422.               function.  NORMAL(x) = NPD(x,0,1);
  423.  
  424.          NPD(x,mean,std) -- Normal  probability  distribution  of  x  with
  425.               specified mean  and  standard  deviation.   X is in units of
  426.               standard deviations from the mean.
  427.  
  428.                 NONLIN -- Nonlinear Regression Program       Page 8
  429.  
  430.  
  431.          PAREA(x) -- Area under the normal probability distribution  curve
  432.               from -infinity to x. (i.e., integral from -infinity to x  of
  433.               NORMAL(x)).
  434.  
  435.          PULSE(a,x,b) -- Pulse function.  If the value of x is less than a
  436.               or greater  than b, the value of the function is 0.  If x is
  437.               greater than or equal to a and less than or equal to b,  the
  438.               value of the function is 1.  In other words, it is 1 for the
  439.               domain (a,b)  and  zero  elsewhere.   If you need a function
  440.               that is zero in the domain (a,b) and 1  elsewhere,  use  the
  441.               expression (1-PULSE(a,x,b)).
  442.  
  443.          RAD(x) -- Converts an angle measured in degrees to the equivalent
  444.               number of radians.
  445.  
  446.          SEC(x) -- Secant of x. (SEC(x) = 1/COS(x)).  Angle in radians.
  447.  
  448.          SEL(a1,a2,v1,v2)  --  If a1 is less than a2 then the value of the
  449.               function is v1.  If a1 is greater than or equal to a2,  then
  450.               the value of the function is v2.
  451.  
  452.          SIN(x) -- Sine of x.  Angles are measured in radians.
  453.  
  454.          SINH(x) -- Hyperbolic sine of x.
  455.  
  456.          SQRT(x) -- Square root of x.
  457.  
  458.          STEP(a,x) --  Step  function.   If x is less than a, the value of
  459.               the function is 0.  If x is greater than or equal to a,  the
  460.               value of the function is 1.  If you need a function which is
  461.               1  up  to  a certain value and then 0 beyond that value, use
  462.               the expression STEP(x,a).  See PIECE.NLR for an  example  of
  463.               this function.
  464.  
  465.          T(n,x) -- Chebyshev polynomial of order n.
  466.  
  467.          TAN(x) -- Tangent of x.  Angles are measured in radians.
  468.  
  469.          TANH(x) -- Hyperbolic tangent of x.
  470.  
  471.          Y0(x) -- Bessel function of the second kind, order zero.
  472.  
  473.          Y1(x) -- Bessel function of the second kind, order one.
  474.  
  475.          YN(n,x) -- Bessel function of the second kind, order n.
  476.  
  477.                 NONLIN -- Nonlinear Regression Program       Page 9
  478.  
  479.  
  480.          NONLIN COMMAND FILES
  481.  
  482.          The commands described in this section are placed  in  a  command
  483.          file.  When you start Nonlin, you specify the name of the command
  484.          file as  a  parameter  on  the command line.  For example, if the
  485.          command file name is CAR.NLR, the following command  would  cause
  486.          Nonlin to execute the commands in the command file:
  487.  
  488.          NONLIN CAR.NLR
  489.  
  490.          If you do not specify a file name extension for the command file,
  491.          ".NLR" is used by default.  The output of the regression for this
  492.          example  would  be written to a file named CAR.LST. Command files
  493.          can be created using a text editor such as  EDIT-32,  EDLIN,  the
  494.          DOS version 5 EDIT program, or any other editor or word processor
  495.          that is capable of creating an ascii text file without formatting
  496.          codes.
  497.  
  498.          Comments  may be placed in command files by preceding the comment
  499.          with an exclamation point.  Entire lines may be used for comments
  500.          and comments can be placed at the end of commands.
  501.  
  502.          Command lines can be continued by placing a  semicolon  character
  503.          as the last non-blank character on the line (a comment may follow
  504.          the  semicolon)  and then continuing the command on the following
  505.          line(s).
  506.  
  507.          Every  command  file  must  contain   the   following   commands:
  508.          VARIABLES,  PARAMETERS,  FUNCTION,  and  DATA. The DATA statement
  509.          introduces the data for the analysis and must be the last command
  510.          in the file (data records  may  follow  it).    Other,  optional,
  511.          commands may be interspersed in the command file.
  512.  
  513.          The following is an example of a complete command file:
  514.  
  515.              VARIABLES  VALUE,AGE,MILES
  516.              PARAMETERS BASE,DEPAGE,DEPMILES
  517.              FUNCTION VALUE = BASE + DEPAGE*AGE + DEPMILES*MILES
  518.              DATA
  519.              (data records follow)
  520.  
  521.  
  522.          NONLIN COMMANDS
  523.  
  524.          The  following is a list of the valid Nonlin commands that can be
  525.          placed in a  Nonlin  command  file.    Command  keywords  may  be
  526.          abbreviated  to  the  first  three  letters  except for CONSTANT,
  527.          CONSTRAIN, and CONFIDENCE which  require  six  letters.    Nonlin
  528.          commands are not case sensitive.
  529.  
  530.                 NONLIN -- Nonlinear Regression Program      Page 10
  531.  
  532.  
  533.          TITLE string (optional) -- Specifies a title line that is printed
  534.               with the results of the analysis.
  535.  
  536.          VARIABLES var1,var2,... (required) -- Specifies the names of  the
  537.               variables that  will be used in the function.  The dependent
  538.               variable and the independent variables  must  be  specified.
  539.               The  order of the variable names must match the order of the
  540.               data  values  on  each  observation  record  (the  dependent
  541.               variable   may   come   before   or  after  the  independent
  542.               variables).  You may define more variables than you actually
  543.               use in  the  function  specification.    A  maximum  of   12
  544.               variables may  be  specified.  The length of a variable name
  545.               is limited to 10 characters.  Capitalize the variable  names
  546.               as you want them displayed in the results.
  547.  
  548.               You  may  specify  all  of the variables on a single command
  549.               line (which may be  continued),  or  you  may  use  multiple
  550.               VARIABLES commands.  If you use multiple commands, the order
  551.               in  which  they  appear  in  the command file must match the
  552.               order of the variable values  on  each  observation  record.
  553.               The  VARIABLES  command  must  precede the FUNCTION command.
  554.               See F33.NLR for an example of a  multiple  regression  using
  555.               three independent variables.
  556.  
  557.          PARAMETERS param1[=initial1],param2[=initial2],...  (required) --
  558.               Specifies the names of the parameters whose values are to be
  559.               determined by Nonlin.  Nonlin is capable of handling  up  to
  560.               12 parameters.    The  parameter  names  may  not  exceed 10
  561.               characters in length.  Do not specify  any  parameters  that
  562.               are not  used  in the function.  The PARAMETERS command must
  563.               precede the FUNCTION command.
  564.  
  565.               Optionally, an initial estimate of the parameter  value  may
  566.               be  specified  by following the parameter name with an equal
  567.               sign and the value.  If no value is specified, 1 is used  by
  568.               default.   Specifying  an  initial  value  that  is near the
  569.               actual value usually speeds up the operation of  Nonlin  and
  570.               may enable  it  to  successfully converge to a solution.  If
  571.               Nonlin is unable to converge to a solution,  try  specifying
  572.               different starting  values  for  the  parameters.    Try  to
  573.               specify a value that at least has the correct  sign  as  the
  574.               expected final value.
  575.  
  576.               The CONSTRAIN command (described below) can be used to limit
  577.               the range  of  values for parameters.  The SWEEP command can
  578.               be used to perform the regression analysis with a  range  of
  579.               parameter initial  values.  The CONSTANT command can be used
  580.               to define a parameter with a fixed value.
  581.  
  582.                 NONLIN -- Nonlinear Regression Program      Page 11
  583.  
  584.  
  585.          CONFIDENCE [percent] (optional) -- Specifies  that  a  confidence
  586.               interval is to be printed for each estimated parameter.  The
  587.               purpose of regression analysis  is  to  determine  the  best
  588.               estimate of   parameter  values.    However,  as  with  most
  589.               statistical  calculations,   the   values   determined   are
  590.               estimates of the true values.  The CONFIDENCE command causes
  591.               Nonlin to print a table showing the range of possible values
  592.               for each  parameter given a specified confidence value.  The
  593.               "percent" parameter spcifies the probability that  that  the
  594.               actual  value  of  the  parameter  is  within the confidence
  595.               interval to be computed.  For example, the command
  596.  
  597.               CONFIDENCE 95
  598.  
  599.               specifies that the confidence interval(s) are to be computed
  600.               such that there is a 95 percent probability that the  actual
  601.               values  of  the parameters are within the intervals (or that
  602.               there is a 5 percent chance that the parameters are  outside
  603.               the intervals).    The "percent" parameter may range from 50
  604.               to 99.999.   If  the  CONFIDENCE  command  is  used  without
  605.               specifiying a percent value, 90 is used by default.
  606.  
  607.          CONSTANT parameter=value  (optional)  --  Specifies the name of a
  608.               symbolic constant and associates a numeric value.   You  may
  609.               then   use  the  symbolic  name  in  the  function  and  the
  610.               corresponding constant numeric value  will  be  substituted.
  611.               This  is useful when you are trying out different models and
  612.               want to easily be able to change a constant value  for  each
  613.               run.   The  CONSTANT  commands  must  precede  the  FUNCTION
  614.               command.  The following is an example of a symbolic constant
  615.               named "Roomtemp" that causes the value 73 to be  substituted
  616.               in the function:
  617.  
  618.               Variable Time            ! Cooling time in seconds
  619.               Variable Temp            ! Temperature of object
  620.               Constant Roomtemp = 73        ! Ambient temperature
  621.               Parameter InitTemp        ! Initial temperature
  622.               Parameter Coolrate        ! Cooling rate factor
  623.               Function Temp = Roomtemp + InitTemp * exp(-Coolrate * Time)
  624.  
  625.          CONSTRAIN parameter=lowvalue,highvalue  (optional) -- Specifies a
  626.               lower and upper limit on the range  of  a  parameter  value.
  627.               During  the solution process, Nonlin may allow a parameter's
  628.               value to temporarily move in a direction away from its final
  629.               value.  With some functions it may be necessary to constrain
  630.               the parameter's value so that it does not go negative (e.g.,
  631.               if the function takes the square root of the parameter),  or
  632.               zero (if the parameter is in a denominator).  If a parameter
  633.               is   tightly   constrained,   Nonlin  may  report  "singular
  634.               convergence" because it is unable to converge to an  optimum
  635.               value  of  the  parameter;  however, the estimated values of
  636.               other parameters may be useful.
  637.  
  638.                 NONLIN -- Nonlinear Regression Program      Page 12
  639.  
  640.  
  641.               Only a single parameter and its  associated  limits  may  be
  642.               specified  on  each  CONSTRAIN  command,  but  you  may  use
  643.               multiple CONSTRAIN  commands.    The PARAMETERS command must
  644.               precede the CONSTRAIN command.  Use the CONSTANT command  if
  645.               you wish to define a parameter with a fixed value.
  646.  
  647.               The  parameter  value is allowed to range from `lowvalue' to
  648.               `highvalue'.  If you want to prevent a parameter value  from
  649.               going  to  zero,  you must specify a value greater than zero
  650.               for the low value (specifying zero would allow it to  reach,
  651.               but not go below, zero).  For example, the following command
  652.               constrains  the  value  of `age' to be greater than zero and
  653.               less than or equal to 100:
  654.  
  655.               CONSTRAIN age = .0001,100
  656.  
  657.               See the COOLING.NLR, F33EXP.NLR,  and  POWER.NLR  files  for
  658.               examples of the CONSTRAIN command.
  659.  
  660.          COVARIANCE  (optional)  --  Causes the variance-covariance matrix
  661.               for the parameters to be printed.
  662.  
  663.          SWEEP parameter=lowvalue,highvalue,stepsize  (optional)        --
  664.               Specifies  that  the  regression analysis is to be performed
  665.               repeatedly with a set of starting values for the  parameter.
  666.               The  first  analysis  is performed with the parameter having
  667.               the `lowvalue'; the value of `stepsize' is then added to the
  668.               parameter's initial value  and  the  analysis  is  performed
  669.               again.   The  process  is  repeated  until  the value of the
  670.               parameter reaches `highvalue'.
  671.  
  672.               Each time  the  analysis  is  performed  the  value  of  the
  673.               residual  sum  of squares is compared with the best previous
  674.               result.  The estimated values of the parameters for the best
  675.               starting value are saved and used for the final analysis and
  676.               report.
  677.  
  678.               Only one parameter may be specified on each  SWEEP  command,
  679.               but  you  may  have  as  many  SWEEP  commands  as there are
  680.               parameters.  The number  of  regression  analyses  performed
  681.               will  be  equal  to  the  product of the number of parameter
  682.               values for each SWEEP command.
  683.  
  684.               The SWEEP command is useful when you are  trying  to  fit  a
  685.               complicated  function  that  may have "local minimum" values
  686.               other than the "global minimum".  Periodic  functions  (sin,
  687.               cos, etc.) are especially troublesome.
  688.  
  689.               See  the  SINE.NLR  command file for an example of the SWEEP
  690.               command.
  691.  
  692.                 NONLIN -- Nonlinear Regression Program      Page 13
  693.  
  694.  
  695.          FUNCTION depvar = function  (required) -- Specifies the  form  of
  696.               the function whose parameters are to  be  determined.    The
  697.               dependent variable must be the only thing to the left of the
  698.               equal sign.    The expression to the right of the equal sign
  699.               may contain variables, parameters, constants, operators, and
  700.               library functions  such  as  sqrt,  sin,  exp,  etc.     The
  701.               VARIABLES  and PARAMETERS commands must have appeared in the
  702.               command file before the FUNCTION command, and all  variables
  703.               and parameters used in the function must have been specified
  704.               on those  commands.  Some example FUNCTION commands are show
  705.               below:
  706.  
  707.               FUNCTION Y = P0 + P1*X
  708.  
  709.               FUNCTION DISTANCE = .5 * ACCEL * TIME^2
  710.  
  711.               FUNCTION VALUE = PRICE + YRDEP*AGE + MILEDEP*MILES
  712.  
  713.               FUNCTION POPULATN = BASE * GROWRATE * EXP(TIME)
  714.  
  715.          TOLERANCE value  (optional,  default=1E-10)  --   Specifies   the
  716.               tolerance   factor  that  is  used  to  determine  when  the
  717.               algorithm has  converged  to  a  solution.    Reducing   the
  718.               tolerance  value may produce a slightly more accurate result
  719.               but will increase the number of iterations and  the  running
  720.               time.
  721.  
  722.          ITERATIONS value  (optional, default=50) -- Specifies the maximum
  723.               number  of  iterations  that  should  be  attempted  by  the
  724.               algorithm.   If  the solution does not converge to the limit
  725.               specified by  the  TOLERANCE  command  (or  to  the  default
  726.               tolerance)  before  the  maximum  number  of  iterations  is
  727.               reached, the process is stopped and the results are printed.
  728.               Failure  to  converge  before  the   specified   number   of
  729.               iterations could be caused by one of three things:
  730.  
  731.               1. The  maximum  allowed  number  of  iterations  may be too
  732.               small.  Try using an ITERATIONS command with a larger value.
  733.  
  734.               2. The tolerance factor may be too small.  Even  a  properly
  735.               converging solution will eventually "level off" or oscillate
  736.               around a  good,  but  non-zero,  sum  of squares value.  Try
  737.               using the TOLERANCE command to increase the tolerance value.
  738.  
  739.               3. The function may  not  be  converging.    Try  specifying
  740.               better  (or  at  least  different)  starting  values for the
  741.               parameters on the PARAMETERS command.   Consider  using  the
  742.               SWEEP  command  to  specify  a  range  of parameter starting
  743.               values.
  744.  
  745.                 NONLIN -- Nonlinear Regression Program      Page 14
  746.  
  747.  
  748.          REGISTER  (optional)  --  The  REGISTER  command  suppresses  the
  749.               copyright and registration message that is normally  printed
  750.               as part  of  a  Nonlin report.  The use of this command is a
  751.               reminder that you should register your use of Nonlin.  Note,
  752.               if  you  find  Nonlin  to   be   useful,   educational,   or
  753.               entertaining  you  are expected to register your use so that
  754.               the author can be justly compensated and that development of
  755.               the program can continue.  Use the form in  REGISTER.DOC  to
  756.               register your use.
  757.  
  758.          OUTPUT [TO file] var1,var2,... (optional) -- Specifies that after
  759.               the  analysis is completed, data values are to be printed or
  760.               written to a file.  If the "TO file" portion of the  command
  761.               is  specified,  the output is written to the specified file.
  762.               If this portion of the command is omitted, the output values
  763.               are printed along with the results.    If  a  file  name  is
  764.               specified without an extension, ".OUT" is used by default.
  765.  
  766.               The  list  of  variable names determines which variables are
  767.               written to the file and the order in which the values appear
  768.               in each output record.  Any variable previously declared  on
  769.               a VARIABLES  command  may  be  specified.   In addition, the
  770.               folowing special variable names may  appear  in  the  output
  771.               list:
  772.  
  773.               $OBS  --  The  observation  record number, starting at 1 and
  774.               increasing by 1.
  775.  
  776.               $PREDICTED -- The predicted value for the dependent variable
  777.               for the observation, given the independent  variable  values
  778.               and the parameters as calculated by the analysis.
  779.  
  780.               $RESIDUAL  -- The difference between the actual value of the
  781.               dependent variable and its predicted value.
  782.  
  783.               Examples of OUTPUT commands are shown below:
  784.  
  785.               OUTPUT AGE,MILES,VALUE,$PREDICTED,$RESIDUAL
  786.  
  787.               OUTPUT TO GROWTH.DAT $OBS,TIME,POPULATN,$PREDICTED
  788.  
  789.          POUTPUT file  (optional) -- The POUTPUT  command  specifies  that
  790.               Nonlin  is  to  write  the  final  estimated  values  of the
  791.               parameters to a file.  Each parameter value is written to  a
  792.               separate line of the file.  This command is useful to create
  793.               a  file of estimated parameter values to be fed into another
  794.               analysis program.
  795.  
  796.          PLOT [options]  (optional) -- Display a plot  of  the  calculated
  797.               function and  the  data  observations.  The PLOT command can
  798.               only  handle  a  single   independent   variable   (multiple
  799.               independent variables would require an n-dimensional surface
  800.               plot);  however,  there  is  no restriction on the number of
  801.  
  802.                NONLIN -- Nonlinear Regression Program      Page 15
  803.  
  804.  
  805.               parameters being estimated.
  806.  
  807.               You  must  have  a  CGA, EGA, or VGA monitor to use the PLOT
  808.               command, and the NONLIN.FON font file must be in the current
  809.               directory  or  in  a  directory  specified  by  the   NONLIN
  810.               environment variable.    In  the  plot,  the data values you
  811.               provided are shown as blue X's and the  function  fitted  to
  812.               the data  by  Nonlin  is shown as a solid green line.  Press
  813.               Return to proceed with the analysis after you have  finished
  814.               looking at the plot.
  815.  
  816.               The following options may be specified on the PLOT command:
  817.  
  818.               GRID  --  display  grid  lines to make it easier to estimate
  819.               values.
  820.  
  821.               RESIDUAL -- draw vertical  lines  from  each  observed  data
  822.               point  to the corresponding point on the calculated function
  823.               line.  These  lines  represent  the  "residual"  value  that
  824.               Nonlin is attempting to minimize.  See also the descriptions
  825.               of the RPLOT and NPLOT commands.
  826.  
  827.               ITERATION   --  draw  a  plot  for  each  iteration  of  the
  828.               regression analysis.  Normally, the plot is drawn after  the
  829.               analysis  has  converged  to  a  solution;  you  may use the
  830.               ITERATION  option  to  observe  the  function  during   each
  831.               iteration of the analysis as it converges to fit the data.
  832.  
  833.               VALUES  --  use  in conjunction with the ITERATION option to
  834.               cause the current parameter values to  be  displayed  before
  835.               the plot for the current iteration.
  836.  
  837.               PRINT -- print a copy of the plot on an HP LaserJet printer.
  838.               Nonlin  writes  the  plot  to  the  PRN device which much be
  839.               attached to an HP Series II or  Series  III  printer.    The
  840.               NONLIN.LJF  font file must be in the current directory or in
  841.               a directory specified by the NONLIN environment variable.
  842.  
  843.               NOPAUSE --  do  not  pause  after  the  plot  is  displayed.
  844.               Normally, Nonlin pauses after displaying a plot to allow you
  845.               time  to  examine  it; you press Enter to continue execution
  846.               once you have finished looking at the  plot.    The  NOPAUSE
  847.               option  causes  Nonlin  to  continue  with execution without
  848.               pausing after the plot is displayed.    This  is  useful  in
  849.               conjunction  with  the  PRINT option when Nonlin is run in a
  850.               batch file and you want to generate a hardcopy plot but  not
  851.               pause after the screen display.
  852.  
  853.               The  option  keywords  may  be  abbrievated  to  their first
  854.               letter.  If more than one option is specified, separate them
  855.               with commas.  For example, to produce a plot with both  grid
  856.               lines and residual lines, use the following command:
  857.  
  858.                 NONLIN -- Nonlinear Regression Program      Page 16
  859.  
  860.  
  861.                   PLOT GRID,RESIDUAL
  862.  
  863.          RPLOT [options]  (optional) -- Display a  plot  of  the  residual
  864.               values.   A  "residual"  value  (or  error deviation) is the
  865.               difference between an actual value of the dependent variable
  866.               for an observation and the  predicted  value  based  on  the
  867.               function fitted   by   the  regression  analysis.    If  the
  868.               calculated function exactly predicted the actual observation
  869.               values, all of the residual values would be zero.   However,
  870.               this  is  usually  not the case and the residual values show
  871.               where, and by how much, the fitted function fails to predict
  872.               the actual observations.
  873.  
  874.               The RPLOT command causes Nonlin to display  a  plot  showing
  875.               the  residual  values  on  the  vertical  (Y)  axis  and the
  876.               independent variable values  on  the  horizontal  (X)  axis.
  877.               However,  if  there  is  more than one independent variable,
  878.               Nonlin displays the residual values on the vertical (Y) axis
  879.               and the dependent variable  values  on  the  horizontal  (X)
  880.               axis.   The  plot  title indicates if the dependent variable
  881.               was used for the X axis.
  882.  
  883.               A residual plot is very useful for determining if  the  form
  884.               of  the  function  being  fitted is appropriate for the data
  885.               values.  If the residual values are randomly distributed  in
  886.               positive  and  negative  directions then the form (shape) of
  887.               the fitted function is probably appropriate for the data and
  888.               the deviations are due to random measurement  errors.    If,
  889.               however,  the  residuals show a systematic pattern such as a
  890.               periodic cycle, then the function may not be appropriate for
  891.               the data values.  See the discussion  of  the  Durbin-Watson
  892.               statistic  for  additional  information about autocorrelated
  893.               residual values.  The PLOT, RPLOT, and NPLOT commands may be
  894.               used in the same command file.  Press Return to proceed with
  895.               the analysis after you have finished looking at the plot.
  896.  
  897.               The following options may be specified on the RPLOT command:
  898.  
  899.               GRID -- display grid lines to make  it  easier  to  estimate
  900.               values.
  901.  
  902.               PRINT -- print a copy of the plot on an HP LaserJet printer.
  903.               Nonlin  writes  the  plot  to  the  PRN device which much be
  904.               attached to an HP Series II or Series III printer.
  905.  
  906.               NOPAUSE --  do  not  pause  after  the  plot  is  displayed.
  907.               Normally, Nonlin pauses after displaying a plot to allow you
  908.               time  to  examine  it; you press Enter to continue execution
  909.               once you have finished looking at the  plot.    The  NOPAUSE
  910.               option  causes  Nonlin  to  continue  with execution without
  911.               pausing after the plot is displayed.
  912.  
  913.                 NONLIN -- Nonlinear Regression Program      Page 17
  914.  
  915.  
  916.               The option  keywords  may  be  abbrievated  to  their  first
  917.               letter.  If more than one option is specified, separate them
  918.               with commas.
  919.  
  920.          NPLOT [options]  (optional) -- Display a normal probability  plot
  921.               of the  residual  values.  In this plot, the actual value of
  922.               each residual is plotted on the vertical (Y)  axis  and  the
  923.               expected  value  of the residual, assuming the residuals are
  924.               normally distributed, is plotted on the horizontal (X) axis.
  925.               If the residuals are  normally  distributed,  the  resulting
  926.               plot will be a straight line passing through the origin with
  927.               a slope of 1 (i.e., the actual value of each residual should
  928.               equal the  expected value from the normal distribution).  If
  929.               the residuals are not normally distributed,  the  plot  will
  930.               deviate from a straight line.
  931.  
  932.               This  plot  also computes the correlation between the actual
  933.               residual values and their expected values and  displays  the
  934.               correlation coefficient  in  the  title line "(r=n.nn)".  If
  935.               the  residual   values   are   normally   distributed,   the
  936.               correlation should  be  close  to 1.00.  A correlation value
  937.               less than 0.94 suggests that the residuals are not  normally
  938.               distributed.
  939.  
  940.               The NPLOT command may be used even if there is more than one
  941.               independent variable.    The PLOT, RPLOT, and NPLOT commands
  942.               may be used in the same  command  file.    Press  Return  to
  943.               proceed with the analysis after you have finished looking at
  944.               the plot.
  945.  
  946.               The following options may be specified on the NPLOT command:
  947.  
  948.               GRID  --  display  grid  lines to make it easier to estimate
  949.               values.
  950.  
  951.               PRINT -- print a copy of the plot on an HP LaserJet printer.
  952.               Nonlin writes the plot to  the  PRN  device  which  much  be
  953.               attached to an HP Series II or Series III printer.
  954.  
  955.               NOPAUSE -- do not pause after the plot is displayed.
  956.  
  957.               The  option  keywords  may  be  abbrievated  to  their first
  958.               letter.  If more than one option is specified, separate them
  959.               with commas.
  960.  
  961.          DOMAIN lowvalue,highvalue (optional) -- Specifies the domain over
  962.               which the plot is to be generated.  If the DOMAIN  statement
  963.               is  omitted,  the domain of the independent variable is used
  964.               for the plot.  The DOMAIN statement can be used to  generate
  965.               a   plot  of  the  fitted  function  extrapolated  over  the
  966.               specified domain.  You can also use the  DOMAIN  command  to
  967.               restrict  the  domain and "zero in" on a particular range of
  968.               the function.  The DOMAIN  command  only  affects  the  PLOT
  969.  
  970.                 NONLIN -- Nonlinear Regression Program      Page 18
  971.  
  972.  
  973.               command; it does not affect the regresson calculation or the
  974.               RPLOT or NPLOT commands.
  975.  
  976.          DATA  [file]  (required)  --  Specifies  the  name  of  the  file
  977.               containing  the data records, or introduces the data records
  978.               which follow the command.  If a file name  is  specified  on
  979.               the  DATA  command, the file is opened, its data records are
  980.               read, and the regression analysis is performed.  If  a  file
  981.               name  is  specified  without an extension, ".DAT" is used by
  982.               default.
  983.  
  984.               If no file name is specified on the DATA command,  the  data
  985.               records  must  immediately  follow  the  DATA command in the
  986.               command file.
  987.  
  988.               Each data record must contain at least as many  data  values
  989.               as  the  number  of  variables  specified  on  the VARIABLES
  990.               command(s).  The order of the variables as specified on  the
  991.               VARIABLES command must match the order of the values in each
  992.               observation.   Any data values beyond those required for the
  993.               specified variables are  ignored.    Each  observation  must
  994.               begin on a new line.
  995.  
  996.               The  data  values  must  be  separated by one or more spaces
  997.               and/or a comma.  Data values may contain decimal points  and
  998.               may be expressed in exponential notation (i.e., n.nnnnEppp).
  999.               As  a  convenience  for  entering  time  values,  if a value
  1000.               contains one or more colons, the portion to the left of  the
  1001.               colon is  multiplied by 60.  For example, 1:00 is equivalent
  1002.               to 60; 1:00:00 is equivalent to 3600.
  1003.  
  1004.               You may continue data lines by specifying a semicolon as the
  1005.               last non-blank character on a record and  then  placing  the
  1006.               continuation value on the following line(s).
  1007.  
  1008.               The  DATA  command  must  be the last command in the command
  1009.               file.  If no file name is specified on the DATA command, the
  1010.               data records must immediately follow the DATA command in the
  1011.               command file.
  1012.  
  1013.               The following is an  example  of  a  complete  command  file
  1014.               including data records:
  1015.  
  1016.               VARIABLES AGE,MILES,VALUE
  1017.               PARAMETERS BASE,DEPAGE,DEPMILES
  1018.               FUNCTION VALUE = BASE + DEPAGE*AGE + DEPMILES*MILES
  1019.               DATA
  1020.               2  10000  13000
  1021.               4  42000   9000
  1022.               1   7000  17000
  1023.               6  52000   6000
  1024.               5  48000   8000
  1025.  
  1026.                 NONLIN -- Nonlinear Regression Program      Page 19
  1027.  
  1028.  
  1029.               If the data records had been placed in a separate file named
  1030.               CAR.DAT,  the   DATA   statement   would   be   changed   to
  1031.               "DATA CAR.DAT".
  1032.  
  1033.  
  1034.          UNDERSTANDING THE RESULTS
  1035.  
  1036.          Nonlin  prints  a  variety  of  statistics  at  the  end  of each
  1037.          analysis.  For each variable, Nonlin lists the minimum value, the
  1038.          maximum value, the mean value, and the standard deviation.    You
  1039.          should  confirm  that  these  values  are  within  the ranges you
  1040.          expect.
  1041.  
  1042.          For  each  parameter,  Nonlin  displays  the  initial   parameter
  1043.          estimate  (which  you specified on the PARAMETER command, or 1 by
  1044.          default), the final (maximum likelihood) estimate,  the  standard
  1045.          error  of  the  estimated  parameter  value,  the  "t"  statistic
  1046.          comparing the  estimated  parameter  value  with  zero,  and  the
  1047.          significance of the t statistic.
  1048.  
  1049.          The  final  estimate  parameter  values  are  the  results of the
  1050.          analysis.  By substituting  these  values  in  the  equation  you
  1051.          specified to be fitted to the data, you will have a function that
  1052.          can  be used to predict the value of the dependent variable based
  1053.          on a set of values for the independent variables.   For  example,
  1054.          if the equation being fitted is
  1055.  
  1056.          y = p0 + p1*x
  1057.  
  1058.          and  the  final  estimates  are 1.5 for p0 and 3 for p1, then the
  1059.          equation
  1060.  
  1061.          y = 1.5 + 3*x
  1062.  
  1063.          is the best equation of this form that will predict the value  of
  1064.          y based on the value of x.
  1065.  
  1066.          The  "t" statistic is computed by dividing the estimated value of
  1067.          the parameter by its standard error.  This statistic is a measure
  1068.          of the likelihood that the actual value of the parameter  is  not
  1069.          zero.   The  larger the absolute value of t, the less likely that
  1070.          the actual value of the parameter could be zero.
  1071.  
  1072.          The "Prob(t)" is the probability that the  actual  value  of  the
  1073.          parameter could  be  zero.  The smaller the value of Prob(t), the
  1074.          more significant  the  parameter.    For  example,   assume   the
  1075.          estimated  value  of a parameter is 1.0 and its standard error is
  1076.          0.7.  Then the t value would be 1.43 (1.0/0.7).  If the  computed
  1077.          Prob(t)  value  was 0.05 then this indicates that there is only a
  1078.          0.05 (5%) chance that the actual value of the parameter could  be
  1079.          zero.  If Prob(t) was 0.001 this indicates there is only 1 chance
  1080.          in 1000  that  the  parameter could be zero.  If Prob(t) was 0.92
  1081.          this indicates that there is a 92% probability  that  the  actual
  1082.  
  1083.                NONLIN -- Nonlinear Regression Program      Page 20
  1084.  
  1085.  
  1086.          value  of the parameter could be zero; this implies that the term
  1087.          of  the  regression  equation  containing  the  parameter  can be
  1088.          eliminated without significantly affecting the  accuracy  of  the
  1089.          regression.   The  t  statistic  probability  is computed using a
  1090.          two-sided test.  The CONFIDENCE command  can  be  used  to  cause
  1091.          Nonlin to  print  confidence intervals for parameter values.  The
  1092.          SQUARE.NLR example regression includes  an  extraneous  parameter
  1093.          (p0)  whose  estimated  value  is  much smaller than its standard
  1094.          error; the Prob(t) value is 0.99982 indicating that  there  is  a
  1095.          high probability that the value is zero.
  1096.  
  1097.          In addition to the variable and parameter values, Nonlin displays
  1098.          several  statistics  that indicate how well the equation fits the
  1099.          data.  The "Final sum of squared deviations" is the  sum  of  the
  1100.          squared  differences  between  the  actual value of the dependent
  1101.          variable for each observation and  the  value  predicted  by  the
  1102.          function, using the final parameter estimates.
  1103.  
  1104.          The  "Average  deviation" is the average over all observations of
  1105.          the absolute value of the difference between the actual value  of
  1106.          the dependent variable and its predicted value.
  1107.  
  1108.          The  "Maximum  deviation  for  any  observation"  is  the maximum
  1109.          difference (ignoring sign) between the actual and predicted value
  1110.          of the dependent variable for any observation.
  1111.  
  1112.          The "Proportion of variance explained (R^2)" indicates  how  much
  1113.          better  the  function  predicts  the dependent variable than just
  1114.          using the mean value of the dependent variable.    This  is  also
  1115.          known as  the  "coefficient  of  multiple  determination."  It is
  1116.          computed as follows: Suppose that we did not fit an  equation  to
  1117.          the  data  and  ignored  all  information  about  the independent
  1118.          variables in each observation.  Then, the best prediction for the
  1119.          dependent variable value for any observation would  be  the  mean
  1120.          value of  the  dependent  variable  over  all  observations.  The
  1121.          "variance" is the sum of the squared differences between the mean
  1122.          value  and  the  value  of  the  dependent  variable   for   each
  1123.          observation.   Now,  if we use our fitted function to predict the
  1124.          value of the dependent  variable,  rather  than  using  the  mean
  1125.          value,  a  second  kind of variance can be computed by taking the
  1126.          sum of the squared difference between the value of the  dependent
  1127.          variable   predicted  by  the  function  and  the  actual  value.
  1128.          Hopefully, the variance computed by using the values predicted by
  1129.          the function is better (i.e., a smaller value) than the  variance
  1130.          computed using  the  mean  value.    The  "Proportion of variance
  1131.          explained" is computed as 1 - (variance using  predicted  value /
  1132.          variance using  mean).    If  the function perfectly predicts the
  1133.          observed data, the value of this statistic will be  1.00  (100%).
  1134.          If  the function does no better a job of predicting the dependent
  1135.          variable than using the mean, the value will be 0.00.
  1136.  
  1137.          The "adjusted coefficient of multiple determination (Ra^2)" is an
  1138.          R^2 statistic adjusted  for  the  number  of  parameters  in  the
  1139.  
  1140.                NONLIN -- Nonlinear Regression Program      Page 21
  1141.  
  1142.  
  1143.          equation and  the  number  of  data  observations.   It is a more
  1144.          conservative  estimate  of  the  percent  of  variance explained,
  1145.          especially when the sample size is small compared to  the  number
  1146.          of parameters.  It is computed using the formula:
  1147.  
  1148.                Ra^2 = 1 - (n-1)/(n-p) * (1-R^2)
  1149.  
  1150.          where  `n'  is  the  number of observations, `p' is the number of
  1151.          parameters, and `R^2' is the unadjusted coefficient  of  multiple
  1152.          determination.
  1153.  
  1154.          The  "Durbin-Watson test for autocorrelation" is a statistic that
  1155.          indicates the likelihood that the deviation  (error)  values  for
  1156.          the regression  have a first-order autoregression component.  The
  1157.          regression  models  assume  that   the   error   deviations   are
  1158.          uncorrelated.    In   business  and  economics,  many  regression
  1159.          applications involve  time  series  data.    If  a   non-periodic
  1160.          function, such as a straight line, is fitted to periodic data the
  1161.          deviations  have  a  periodic  form and are positively correlated
  1162.          over time; these deviations are said to  be  "autocorrelated"  or
  1163.          "serially correlated."      Autocorrelated  deviations  may  also
  1164.          indicate that the form (shape) of the function  being  fitted  is
  1165.          inappropriate for the data values (e.g., a linear equation fitted
  1166.          to quadratic data).
  1167.  
  1168.          If  the  deviations  are autocorrelated, there may be a number of
  1169.          consequences  for  the  computed  results:   1)   The   estimated
  1170.          regression  coefficients  no  longer  have  the  minimum variance
  1171.          property;  2)  the  mean  square  error   (MSE)   may   seriously
  1172.          underestimate  the  variance  of the error terms; 3) the computed
  1173.          standard  error   of   the   estimated   parameter   values   may
  1174.          underestimate the true standard error, in which case the t values
  1175.          and confidence  intervals  may  be  incorrect.    Note that if an
  1176.          appropriate periodic function is fitted  to  periodic  data,  the
  1177.          deviations  from  the regression will be uncorrelated because the
  1178.          cycle of the data values is accounted for by the fitted function.
  1179.  
  1180.          Small values of the Durbin-Watson statistic indicate the presence
  1181.          of autocorrelation.    Consult  significance  tables  in  a  good
  1182.          statistics  book for exact interpretations; however, a value less
  1183.          than 0.80 usually indicates that autocorrelation is likely.    If
  1184.          the  Durbin-Watson  statistic  indicates that the residual values
  1185.          are autocorrelated, it is recommended  that  you  use  the  RPLOT
  1186.          and/or NPLOT commands to display a plot of the residual values.
  1187.  
  1188.          If  an NPLOT command is used to produce a normal probability plot
  1189.          of the residuals, the correlation between the residuals and their
  1190.          expected values  (assuming  they  are  normally  distributed)  is
  1191.          printed in   the   listing.     If  the  residuals  are  normally
  1192.          distributed, the  correlation  should  be  close  to  1.00.     A
  1193.          correlation  less  than  0.94 suggests that the residuals are not
  1194.          normally distributed.
  1195.  
  1196.                 NONLIN -- Nonlinear Regression Program      Page 22
  1197.  
  1198.  
  1199.          An "Analysis of Variance" table  provides  statistics  about  the
  1200.          overall significance of the model being fitted.
  1201.  
  1202.  
  1203.          THEORY OF OPERATION
  1204.  
  1205.          Nonlin uses a model/trust-region technique along with an adaptive
  1206.          choice of the model Hessian.   The  algorithm  is  essentially  a
  1207.          combination  of  Gauss-Newton  and  Levenberg-Marquardt  methods;
  1208.          however, the adaptive algorithm  often  works  much  better  than
  1209.          either of these methods alone.
  1210.  
  1211.          The  basis  for  the  minimization technique used by Nonlin is to
  1212.          compute the sum of the squared residuals for one set of parameter
  1213.          values and then slightly alter each parameter value and recompute
  1214.          the sum of squared residuals  to  see  how  the  parameter  value
  1215.          change affects the sum of the squared residuals.  By dividing the
  1216.          difference  between  the original and new sum of squared residual
  1217.          values by the amount the parameter was altered, Nonlin is able to
  1218.          determine the approximate partial derivative with respect to  the
  1219.          parameter.   This  partial derivative is used by Nonlin to decide
  1220.          how to alter the value of the parameter for the next iteration.
  1221.  
  1222.          If the function being modeled is well behaved, and  the  starting
  1223.          value  for  the  parameter is not too far from the optimum value,
  1224.          the procedure will eventually converge to the best  estimate  for
  1225.          the parameter.   This procedure is carried out simultaneously for
  1226.          all parameters  and  is,  in  fact,  a  minimization  problem  in
  1227.          n-dimensional space, where `n' is the number of parameters.
  1228.  
  1229.          For  a much more detailed explanation of the regression algorithm
  1230.          used by Nonlin see ACM Transactions on Mathematical Software  7,3
  1231.          (Sept.  1981)  "Dennis,  J.E.,  Gay, D.M., and Welsch, R.E. -- An
  1232.          adaptive nonlinear least-squares algorithm."
  1233.  
  1234.  
  1235.          CONVERGENCE CRITERION
  1236.  
  1237.          Nonlin has several convergence criterion that stop the  iterative
  1238.          minimization procedure.    The  TOLERANCE  command can be used to
  1239.          alter the convergence tolerance value.
  1240.  
  1241.          Two internal variables are used to determine when convergence has
  1242.          occurred.  RFCTOL has a default value of 1E-10 and can be altered
  1243.          by use of the TOLERANCE command.  AFCTOL has a default  value  of
  1244.          1E-20  and  is only altered by the TOLERANCE command if the value
  1245.          specified is less than the default  value.    In  the  discussion
  1246.          which follows the "function value" is half the sum of the squared
  1247.          residuals computed using the current parameter estimates.
  1248.  
  1249.          "Relative  function  convergence"  is  reported  if the predicted
  1250.          maximum possible function reduction  is  at  most  RFCTOL*ABS(F0)
  1251.          where  F0  is  the  function  value  at  the start of the current
  1252.  
  1253.                 NONLIN -- Nonlinear Regression Program      Page 23
  1254.  
  1255.  
  1256.          iteration, and if the last step attempted achieved no  more  than
  1257.          twice the predicted function decrease.
  1258.  
  1259.          "Absolute function convergence" is reported if the function value
  1260.          is less than AFCTOL.
  1261.  
  1262.  
  1263.          HINTS FOR NONLIN USE
  1264.  
  1265.          Convergence Failures
  1266.  
  1267.          One of  the  potential  problems  that  confronts  any  nonlinear
  1268.          minimization procedure  is  non-convergence.   Non-convergence is
  1269.          usually not a problem for regressions using a linear  model,  but
  1270.          becomes  a  more  serious  consideration  when  using complicated
  1271.          nonlinear  functions;  increasing  the   number   of   parameters
  1272.          aggravates the problem.
  1273.  
  1274.          Non-convergence  can  occur in two ways: the solution may diverge
  1275.          or it may converge to the  wrong  solution  --  a  local  minimum
  1276.          rather than the global minimum.  Periodic functions, such as sin,
  1277.          and cos,  are  particularly  prone  to convergence problems.  For
  1278.          example, consider  a  nonlinear  regression  performed  with  the
  1279.          function:
  1280.  
  1281.          y = offset + amplitude * sin(frequency * x)
  1282.  
  1283.          where x and y are variables, and offset, amplitude, and frequency
  1284.          are the  parameters  whose  values  are to be determined.  If the
  1285.          starting value for frequency  is  not  reasonably  close  to  the
  1286.          correct value, the solution may converge to a harmonic (multiple)
  1287.          or subharmonic  (fundamental)  value of the frequency.  A command
  1288.          file named SINE.NLR is supplied with the  commands  and  data  to
  1289.          perform this analysis.
  1290.  
  1291.          The  SWEEP  command  can  be  very  useful in cases like the sine
  1292.          example.  In the SINE.NLR example analysis, the actual  value  of
  1293.          the  frequency  is  3;  the  function  converges  to  the correct
  1294.          solution if the starting value  is  in  the  range  2.6  to  3.3.
  1295.          However,  this example is quite insensitive to the starting value
  1296.          of the amplitude parameter.  With  an  actual  value  of  2,  the
  1297.          correct  solution  is  found  with starting values from 1 through
  1298.          10000.  Similarly, the offset  parameter,  which  had  an  actual
  1299.          value  of  10,  was  successfully determined with starting values
  1300.          ranging from 1 to over 50000.
  1301.  
  1302.          Another example which is sensitive to a parameter starting  value
  1303.          is  POWER.NLR  which  attempts  to  determine  the  values of the
  1304.          parameters p0, p1, and p2 for the function
  1305.  
  1306.          y = p0 + p1*x^p2
  1307.  
  1308.                 NONLIN -- Nonlinear Regression Program      Page 24
  1309.  
  1310.  
  1311.          (where "x^p2" means x raised to the p2 power).  The actual  value
  1312.          of p2 in the example data is 2; the solution converges  correctly
  1313.          if the  starting value of p2 is in the range 1.8 to 3.8.  As with
  1314.          the other example, the solution is relatively insensitive to  the
  1315.          starting values of p0 and p1.
  1316.  
  1317.          Singular Matrix Problems
  1318.  
  1319.          Another  possible  problem is that the analysis may stop with the
  1320.          message "Singular convergence.  Mutually dependent  parameters?".
  1321.          This  is  usually  due  to  one  of  two  things: (1) a redundant
  1322.          parameter that is co-dependent with another parameter, or  (2)  a
  1323.          situation where the value of one parameter "blocks" the effect of
  1324.          other parameters.
  1325.  
  1326.          As an example of a redundant parameter, consider the function
  1327.  
  1328.          y = p0 + p1*p2*x
  1329.  
  1330.          This is a simple linear equation except there are two parameters,
  1331.          p1, and  p2, which are both factors to the variable x.  It should
  1332.          be clear that there is no unique solution to this  problem  since
  1333.          any  value  of p1 is possible if the right value of p2 is chosen.
  1334.          Similarly, the function
  1335.  
  1336.          y = p0 + p1 + p2*x
  1337.  
  1338.          has no unique solution since either p0 or p1 is redundant.
  1339.  
  1340.          Similarly, in the equation
  1341.  
  1342.          y = p0 + p1*exp(x+p2)
  1343.  
  1344.          either p1 or p2 is redundant.
  1345.  
  1346.          The second type of singular matrix problem can be illustrated  by
  1347.          the function
  1348.  
  1349.          y = p0 + p1*x^p2
  1350.  
  1351.          If,  during  the  solution process, p1 takes on the value 0, then
  1352.          varying the value of p2 has no effect on the equation and  Nonlin
  1353.          cannot  figure  out  which  way to change the value of p2 to move
  1354.          toward convergence.  The solution to this problem is to assign  a
  1355.          starting  value  that  is  not  zero to p1, and use the CONSTRAIN
  1356.          command to force p1 to remain non-zero.
  1357.  
  1358.                NONLIN -- Nonlinear Regression Program      Page 25
  1359.  
  1360.  
  1361.          PERFORMANCE ISSUES
  1362.  
  1363.          Nonlin  is  carefully  programmed and compiled with an optimizing
  1364.          compiler for maximum performance.   However,  Nonlin  is  a  real
  1365.          "number  cruncher,"  and  the  nonlinear  regression algorithm is
  1366.          mathematically very elaborate.   During  each  iteration,  Nonlin
  1367.          computes  gradients,  Jacobians,  Hessians,  and eigenvalues, and
  1368.          performs QR and Cholesky matrix decompositions.  All calculations
  1369.          are carried out using double precision (64 bit) floating point.
  1370.  
  1371.          Nonlin does not require an 80x87  numeric  coprocessor,  but  its
  1372.          performance is  greatly  enhanced if one is present.  In fact, an
  1373.          8088 CPU with an 8087 numeric coprocessor can perform  regression
  1374.          analyses  faster  than  a  20 MHz  80386  that  does  not  have a
  1375.          coprocessor.  If you have  an  8088  without  a  coprocessor,  be
  1376.          patient -- Nonlin is probably giving it the workout of its life.
  1377.  
  1378.          Very  long  running times can result if you use the SWEEP command
  1379.          with many starting values.  The problem is compounded if you have
  1380.          multiple SWEEP commands.  If you use the SWEEP command to  try  a
  1381.          large  number  of starting parameter values, you can save time by
  1382.          using the  ITERATIONS  command  to  specify  a  small  number  of
  1383.          iterations  (such  as  5)  during  the  initial attempt to find a
  1384.          solution.  Once a feasible set of starting parameter  values  has
  1385.          been  determined,  remove the SWEEP command, specify the starting
  1386.          values  on  the  PARAMETERS  command,  increase  the  number   of
  1387.          iterations, and rerun the analysis to get the final result.
  1388.  
  1389.          PROGRAM LIMITS
  1390.  
  1391.          The following is a summary of the Nonlin program limitations:
  1392.  
  1393.          Maximum number of variables = 12
  1394.          Maximum number of parameters = 12
  1395.          Maximum length of variable or parameter names = 10
  1396.  
  1397.          The  maximum  number  of data observations that Nonlin can handle
  1398.          depends on the number of parameters as shown by  the  table  that
  1399.          follows:
  1400.  
  1401.               # Parameters    Max Observations
  1402.                     1               2019
  1403.                     2               1611
  1404.                     3               1339
  1405.                     4               1144
  1406.                     5                997
  1407.                     6                883
  1408.                     7                791
  1409.                     8                715
  1410.                     9                652
  1411.                    10                599
  1412.  
  1413.                 NONLIN -- Nonlinear Regression Program      Page 26
  1414.  
  1415.  
  1416.          EXAMPLE ANALYSES
  1417.  
  1418.          A number of example regression analysis files are  provided  with
  1419.          your Nonlin  distribution.  All of the example command files have
  1420.          the extension ".NLR".  Some of the important ones  are  described
  1421.          below, others contain comment lines that explain what they do.
  1422.  
  1423.          LINEAR.NLR  -- Simple linear regression with plotted function and
  1424.               data.
  1425.  
  1426.          QUAD.NLR -- Fit a quadratic equation.  Plot the function and  the
  1427.               data.
  1428.  
  1429.          ASYMPTOT.NLR -- Fit an asymptotic function Y = 12 - 10/X.
  1430.  
  1431.          F33.NLR  -- Multivariate linear regression (multiple regression).
  1432.               Calculate the value of a used  Beech  F33  Bonanza  airplane
  1433.               using  a  linear model based on its age, the number of hours
  1434.               on its airframe, and the number of hours on its engine.  The
  1435.               t value and Prob(t) indicate that the number of hours on the
  1436.               engine  (`Engdep'  parameter)  is  not  signficant  to   the
  1437.               regression  model;  the other parameters are significant but
  1438.               airframe hours is less significant than the base  price  and
  1439.               age of the plane.
  1440.  
  1441.          F33YEAR.NLR -- Similar to F33.NLR except the price of the Bonanza
  1442.               is calculated based on a linear function of only the age.
  1443.  
  1444.          F33EXP.NLR   --   Similar   to   F33YEAR.NLR  except  a  negative
  1445.               exponential function is used rather than a linear  function.
  1446.               Compare  the  fit of this model with that of the F33YEAR.NLR
  1447.               example.
  1448.  
  1449.          SINE.NLR -- Fit an equation involving a sin function.  The  SWEEP
  1450.               command is used to find a starting point that will converge.
  1451.  
  1452.          SQUARE.NLR --  Fit  a sine series to a square wave.  Note in this
  1453.               example  that  the  'p0'  parameter,  which  represents  the
  1454.               constant  term  of  the  equation, has an estimated value of
  1455.               9.22715E-006 (very nearly zero)  and  a  standard  error  of
  1456.               0.0398754.  This yields a t value of nearly zero and Prob(t)
  1457.               of  0.99982  which means that there is a 99.982% chance that
  1458.               the actual value of p0 may be zero (it  is  in  fact  zero).
  1459.               This  illustrates how you can use the t value and Prob(t) to
  1460.               identify extraneous parameters.
  1461.  
  1462.          COOLING.NLR -- Fit an equation involving an exponential function.
  1463.               If a heated object is allowed to cool, the rate  of  cooling
  1464.               at any instant is proportional to the difference between the
  1465.               object's temperature and the ambient (room) temperature.  In
  1466.               other  words,  an  object cools faster at first, while it is
  1467.               hot, and the rate of cooling slows down as  the  temperature
  1468.               of the  object  approaches  the  ambient  temperature.   The
  1469.  
  1470.                NONLIN -- Nonlinear Regression Program      Page 27
  1471.  
  1472.  
  1473.               function that relates the object's temperature to time is:
  1474.  
  1475.               Temperature = Roomtemp+InitTemp*exp(-Coolrate*Time)
  1476.  
  1477.               Where   InitTemp   is  the  number  of  degrees  above  room
  1478.               temperature at time 0, and Coolrate is a factor that depends
  1479.               on the mass of the object, how well it  is  insulated,  etc.
  1480.               The  exp function is the value of e (2.7182818...) raised to
  1481.               a power.  The COOLING.NLR example determines the  parameters
  1482.               InitTemp  and  Coolrate  to  fit an equation of this form to
  1483.               some data the author collected.
  1484.  
  1485.          BOIL.NLR -- The boiling point of water decreases as the  pressure
  1486.               in  the  vessel containing the water decreases. "Clapeyron's
  1487.               equation"  shows  that  the  boiling  point  is  related  to
  1488.               pressure according to the following function:
  1489.  
  1490.               Temperature = b / log(Pressure/a) - 459.7
  1491.  
  1492.               Where  `Temperature'  is  in  degrees  Fahrenheit (the 459.7
  1493.               constant converts degrees Fahrenheit to degrees  Rankine  --
  1494.               relative  to  absolute  zero), `Pressure' is the pressure in
  1495.               the vessel in pounds per square inch, and `a'  and  `b'  are
  1496.               parameters whose  values are to be determined.  The data for
  1497.               this example was collected by the author's son for a science
  1498.               project.
  1499.  
  1500.          MAGNET.NLR -- Fit a function  involving  an  arc  tangent  and  a
  1501.               variable to the third power.  This is an interesting physics
  1502.               problem.   If  a magnet is placed due east of a compass, the
  1503.               deflection of the compass needle from north is equal to  the
  1504.               arc  tangent  of  the  ratio of the strength of the magnet's
  1505.               field relative to the earth's magnetic field.  The  strength
  1506.               of   the   magnet's   field  at  the  compass  is  inversely
  1507.               proportional to the cube of the distance from the magnet  to
  1508.               the compass.  Thus, the function relating these terms is
  1509.  
  1510.               Deflection = deg(atan(Strength / Distance ^ 3))
  1511.  
  1512.               The  deg  function  converts an angle in radians to degrees.
  1513.               In the example, Deflection and Distance are  the  variables,
  1514.               and the value of the Strength parameter is determined.
  1515.  
  1516.          DIODE.NLR -- The current through a diode increases sharply as the
  1517.               voltage across  the  diode  is  increased.  An equation that
  1518.               approximates the current flow as a function of  the  voltage
  1519.               is:
  1520.  
  1521.                       I = exp(b*(V-c))
  1522.  
  1523.               where  `I'  is the current, `V' is the voltage, and `b', and
  1524.               `c' are parameters that are to be estimated by the nonlinear
  1525.               regression.
  1526.  
  1527.                NONLIN -- Nonlinear Regression Program      Page 28
  1528.  
  1529.  
  1530.  
  1531.          AVLTIME.NLR  --  An  AVL  tree  is a balanced binary tree used to
  1532.               store information in  a  computer's  memory.    Because  the
  1533.               entries  in  an  AVL  tree are kept in sorted order, and the
  1534.               tree is kept in a balanced form, it is possible  to  rapidly
  1535.               find any  entry in the tree.  The time required to create an
  1536.               AVL tree with N entries is approximately equal to:
  1537.  
  1538.                        Time = a + b*N*log2(N)
  1539.  
  1540.               where `a' is a constant term equal to the overhead  involved
  1541.               in  starting  and  completing  a tree creation, and `b' is a
  1542.               growth  coefficient  that  depends  on  the  speed  of   the
  1543.               computer.   The log2(N) function is the log base 2 of N (the
  1544.               number of  entries).    The  AVLTIME.NLR  example  fits   an
  1545.               equation  to  a  data  set  that relates the time in seconds
  1546.               required to create an AVL tree with the number of entries in
  1547.               the tree.
  1548.  
  1549.          PIECE.NLR --  Piecewise  linear  function.     Fit   a   function
  1550.               consisting of two linear pieces that bend at X=5.  When X is
  1551.               less than  5,  the  slope  of the function is B1.  When X is
  1552.               greater than or equal to 5, the slope is B2.  B0  is  the  Y
  1553.               value  of  the  function  at X=5 (i.e., at the pivot point).
  1554.               The step(a,x) function returns the value 0 when  x  is  less
  1555.               than  `a';  it  returns 1 when x is greater than or equal to
  1556.               `a'.
  1557.  
  1558.  
  1559.          NONLIN USE FOR ROOT FINDING AND FUNCTION MINIMIZATION
  1560.  
  1561.          Although it is designed for nonlinear regression analysis, Nonlin
  1562.          can also be used  to  find  the  root  (zero  point)  or  minimum
  1563.          absolute value  of a nonlinear expression.  To use Nonlin in this
  1564.          fashion  follow  these  steps:  (1)  Do  not  use  any   VARIABLE
  1565.          statements; (2) Use PARAMETER statements to specify the names and
  1566.          optional  starting  values for the parameters whose values are to
  1567.          be determined as the roots or minimum value  of  the  expression;
  1568.          (3)  Use  the  FUNCTION statement to specify the expression whose
  1569.          roots or minimum value is to be found; do NOT specify a dependent
  1570.          variable and equal sign -- specify only the expression that is to
  1571.          be minimized; (4) Do not include any data records after the  DATA
  1572.          statement;  it  simply  signals  the  end of the command file and
  1573.          causes the analysis to begin.
  1574.  
  1575.          The following is an example command file to find the root of  the
  1576.          expression SIN(X)-LOG(X):
  1577.  
  1578.              PARAMETER X
  1579.              FUNCTION SIN(X) - LOG(X)
  1580.              DATA
  1581.  
  1582.                NONLIN -- Nonlinear Regression Program      Page 29
  1583.  
  1584.  
  1585.          Notice  that the "variable" in the expression, X, is not declared
  1586.          to be  a  variable  but  rather  a  parameter.    This example is
  1587.          included in the file MINSL.NLR which you can run.
  1588.  
  1589.          For this type of analysis, Nonlin determines the  values  of  the
  1590.          parameters  that  minimize  the absolute value of the expression.
  1591.          If the expression has a zero value (i.e., a root), that value  is
  1592.          found since that is the smallest possible absolute value.  If the
  1593.          expression  does  not  have  a  zero point, Nonlin determines the
  1594.          values of the parameters that produce the smallest absolute value
  1595.          of the expression.  For example, the expression 2*x^2-3*x+10 does
  1596.          not have a root but reaches a minimum value of 8.875  when  x  is
  1597.          0.75.  The MINPAROB.NLR command file contains this example.
  1598.  
  1599.          There  are a number of cautions that you should keep in mind when
  1600.          using Nonlin to find roots or minimum values:
  1601.  
  1602.          1. Nonlin will find only one root or minimum value per  analysis.
  1603.             For  example,  the  expression 9-x^2 has two roots: -3 and +3.
  1604.             Nonlin will find one of the roots; which one it finds  depends
  1605.             on the starting value specified for X.
  1606.  
  1607.          2. Nonlin will find only real roots, not complex.
  1608.  
  1609.          3. If the expression contains a local minimum, Nonlin may find it
  1610.             rather than the global minimum or root.  Of course, if you are
  1611.             looking  for a local minimum in a certain region this could be
  1612.             considered a   feature.      For   example,   the   expression
  1613.             0.5*x^3+5*(x-2)^2+15  has a local minimum at x=1.61 and a root
  1614.             at x=-13.38.  If the starting value of x is less than -8.3 the
  1615.             root is found; if the starting value is greater than -8.3, the
  1616.             local minimum is found.  If the  expression  contains  only  a
  1617.             single  variable,  use  the  Mathplot  program  to graphically
  1618.             display the expression and determine a good starting value for
  1619.             the variable (see the end  of  this  document  for  additional
  1620.             information about  Mathplot).    The SWEEP command can also be
  1621.             used to try multiple starting  values  when  searching  for  a
  1622.             global minimum.
  1623.  
  1624.          FUNCTION MINIMIZATION EXAMPLES
  1625.  
  1626.          MINFALL.NLR  --  The  time  taken  for  an object to slide down a
  1627.               frictionless guide from position (0,h) to  another  position
  1628.               (d,0)  (i.e.,  falling  through  a distance `h' while moving
  1629.               horizontally a distance `d') depends on the  path  that  the
  1630.               object takes as it follows the guide.  It turns out that the
  1631.               path  that minimizes the descent time is not a straight line
  1632.               from  (0,h)  to  (d,0)  but  rather   a   curve   called   a
  1633.               brachistochrone  with  a  steeper  slope near the beginning,
  1634.               that gives the object a chance to  accelerate  quickly,  and
  1635.               then a  shallower  slope  further  on.  Finding the shape of
  1636.               this curve is a classic problem in the branch of mathematics
  1637.               called the Calculus of  Variations.    The  MINFALL  example
  1638.  
  1639.                NONLIN -- Nonlinear Regression Program      Page 30
  1640.  
  1641.  
  1642.               solves  a  simpler  case  of this problem: the object slides
  1643.               along  a  straight  guide  from  (0,1000) to an intermediate
  1644.               position (px,py), and then along another straight guide from
  1645.               (px,py) to (1000,0).  What  point,  (px,py),  minimizes  the
  1646.               descent time? [Note concerning the answer: The fall time for
  1647.               the  object  if it follows a straight guide from (0,1000) to
  1648.               (1000,0) is 2.0203 seconds; the fall time if it follows  the
  1649.               two  straight  segments found by MINFALL is 1.8748; the fall
  1650.               time if it  follows  the  ideal  curved  brachistochrone  is
  1651.               1.8590.   The  speed of the object at the end of the fall is
  1652.               the same regardless  of  the  path  taken  (conservation  of
  1653.               energy).]
  1654.  
  1655.          MINFUEL.NLR  --  A  lunar lander is hovering above the surface of
  1656.               the moon looking for a suitable  landing  site.    Available
  1657.               fuel  is  critical  and the desired site is 200 meters away.
  1658.               How long should the horizontal thruster be  fired  to  start
  1659.               and stop  the motion over the ground?  The vertical thruster
  1660.               must be used continuously to  keep  the  lander  from  being
  1661.               pulled to  the  surface.  If too little horizontal thrust is
  1662.               used the spacecraft will move slowly and much fuel  will  be
  1663.               consumed  by  the  vertical  thruster  counterbalancing  the
  1664.               downward gravitational pull while hovering over the surface.
  1665.               On the other hand, if the horizontal thruster is fired for a
  1666.               a long time, the spacecraft will  move  quickly  (minimizing
  1667.               the  hovering  time)  but excessive fuel will be used during
  1668.               the horizontal acceleration and deceleration.    MINFUEL.NLR
  1669.               determines  how long the thruster should be fired during the
  1670.               start and  stop  accelerations  such  that  the  total  fuel
  1671.               consumption   (start  thrust  +  stop  thrust  +  hover)  is
  1672.               minimized.
  1673.  
  1674.  
  1675.          ACKNOWLEDGEMENT
  1676.  
  1677.          The nonlinear regression algorithm used by Nonlin  was  published
  1678.          in  ACM  Transactions  on  Mathematical Software 7,3 (Sept. 1981)
  1679.          "Dennis, J.E.,  Gay,  D.M.,  and  Welsch,  R.E.  --  An  adaptive
  1680.          nonlinear least-squares algorithm."
  1681.  
  1682.  
  1683.          USE AND DISTRIBUTION OF NONLIN
  1684.  
  1685.          Nonlin is  a "shareware" product.  You are welcome to make copies
  1686.          of this program and pass them on to friends or post this  program
  1687.          on bulletin boards (in its original, unmodified form).
  1688.  
  1689.          As  a  shareware product, you are granted a no-cost, trial period
  1690.          of 30 days during which you may evaluate Nonlin.    If  you  find
  1691.          Nonlin  to  be  useful,  educational,  and/or  entertaining,  and
  1692.          continue to use it beyond  the  30  day  trial  period,  you  are
  1693.          required  to  compensate  the  author by sending the registration
  1694.          form printed at the end of this document  (and  in  REGISTER.DOC)
  1695.  
  1696.                NONLIN -- Nonlinear Regression Program      Page 31
  1697.  
  1698.  
  1699.          with   the   appropriate  registration  fee  to  help  cover  the
  1700.          development and support of Nonlin.
  1701.  
  1702.          In  return  for  registering,  you will be authorized to continue
  1703.          using Nonlin beyond the trial period and  you  will  receive  the
  1704.          most  recent  version  of  the  program,  a  laser-printed, bound
  1705.          manual, and three months  of  support  via  telephone,  mail,  or
  1706.          CompuServe.   Your  registration  fee  will  be  refunded  if you
  1707.          encounter a serious bug that cannot be corrected.
  1708.  
  1709.          The author frequently improves Nonlin and it is likely  that  the
  1710.          version you  have is not the most recent version.  Note, the cost
  1711.          of registering Nonlin is insignificant  compared  with  what  you
  1712.          would  have  to  pay to purchase a commercial statistical package
  1713.          with an equivalent regression capability.
  1714.  
  1715.          You are welcome to contact the author:
  1716.  
  1717.                                 Phillip H. Sherrod
  1718.                                  4410 Gerald Place
  1719.                              Nashville, TN  37205-3806
  1720.                               615-292-2881 (evenings)
  1721.                                CompuServe: 71333,27
  1722.  
  1723.          Both the Nonlin program and documentation are copyright (c)  1992
  1724.          by Phillip  H.  Sherrod.    You  are not authorized to modify the
  1725.          program. "Nonlin" is a trademark.
  1726.  
  1727.          Disclaimer
  1728.  
  1729.          Nonlin is provided "as is" without warranty of any  kind,  either
  1730.          expressed or  implied.    This  program  may  contain  "bugs" and
  1731.          inaccuracies, and its results should not be assumed to be correct
  1732.          unless they are  verified  by  independent  means.    The  author
  1733.          assumes  no  responsibility for the use of Nonlin and will not be
  1734.          responsible for any damage resulting from its use.
  1735.  
  1736.                NONLIN -- Nonlinear Regression Program      Page 32
  1737.  
  1738.  
  1739.  
  1740.  
  1741.                                   M A T H P L O T
  1742.  
  1743.  
  1744.                       Mathematical Function Plotting Program
  1745.  
  1746.  
  1747.                                    Special Offer
  1748.  
  1749.  
  1750.  
  1751.          If  you like Nonlin, you should check out the Mathplot program by
  1752.          the same author.
  1753.  
  1754.          Mathplot allows you to specify complicated mathematical functions
  1755.          using ordinary algebraic expressions and immediately  plot  them.
  1756.          Four  types  of  functions  may be specified: cartesian (Y=f(X));
  1757.          parametric    cartesian    (Y=f(T)     and     X=f(T));     polar
  1758.          (Radius=f(Angle));   and   parametric   polar   (Radius=f(T)  and
  1759.          Angle=f(T)).  Up to four functions may be plotted simultaneously.
  1760.          Scaling is automatic.  Options  are  available  to  control  axis
  1761.          display and labeling as well as grid lines.  Hard copy output may
  1762.          be generated  as  well  as  screen display.  Mathplot is an ideal
  1763.          tool for engineers, scientists, math and  science  teachers,  and
  1764.          anyone   else   who   needs  to  quickly  visualize  mathematical
  1765.          functions.
  1766.  
  1767.  
  1768.          SPECIAL OFFER
  1769.  
  1770.          Registered users of Nonlin can order Mathplot for a special price
  1771.          of $18.  Or, for an even better deal, if you register Nonlin  and
  1772.          order Mathplot at the same time, you can get both for $40.
  1773.  
  1774.                 NONLIN -- Nonlinear Regression Program      Page 33
  1775.  
  1776.  
  1777.                         TSX-32 Multi-User Operating System
  1778.  
  1779.          If you have a need  for  a  multi-user,  multi-tasking  operating
  1780.          system, you  should look into TSX-32.  TSX-32 is a full-featured,
  1781.          high performance, multi-user operating system for the 386 and 486
  1782.          that provides both 32-bit  and  16-bit  program  support.    With
  1783.          facilities  such  as  multitasking and multisessions, networking,
  1784.          virtual memory,  background  batch  queues,  data  caching,  file
  1785.          access control, real-time, and dial-in support, TSX-32 provides a
  1786.          solid environment for a wide range of applications.
  1787.  
  1788.          TSX-32 is not a limited, 16-bit, multi-DOS add-on.  Rather, it is
  1789.          a  complete  32-bit  operating system which makes full use of the
  1790.          hardware's potential, including protected mode execution, virtual
  1791.          memory, and demand paging.  TSX-32 sites range from small systems
  1792.          with 2-3 terminals to  large  installations  with  more  than  64
  1793.          terminals on a single 386.
  1794.  
  1795.          In  addition  to  supporting  most  popular  16-bit DOS programs,
  1796.          TSX-32 also provides a 32-bit "flat" address space with both Phar
  1797.          Lap and DPMI compatible modes of execution.
  1798.  
  1799.          Since the DOS file structure is  standard  for  TSX-32,  you  can
  1800.          directly read  and write DOS disks.  And, you can run DOS part of
  1801.          the time and TSX-32 the rest of the time on the same computer.
  1802.  
  1803.          TSX-32 allows each user to control up to 10 sessions.    Programs
  1804.          can also  "fork"  subtasks  for multi-threaded applications.  The
  1805.          patented Adaptive Scheduling Algorithm provides consistently good
  1806.          response time under varying conditions.
  1807.  
  1808.          The TSX-32  network  option  provides  industry  standard  TCP/IP
  1809.          networking through  Ethernet  and  serial  lines.    Programs can
  1810.          access files on  remote  machines  as  easily  as  on  their  own
  1811.          machine.   The  SET  HOST command allows a user on one machine to
  1812.          log onto another computer in the network.  FTP, Telnet,  and  NFS
  1813.          are available for interoperability with other systems.
  1814.  
  1815.          TSX-32  allows  simultaneous  real-time  program  execution  with
  1816.          normal time-sharing operations.  Real-time programs  can  connect
  1817.          to  interrupts,  access  device  control ports, and preempt other
  1818.          operations when necessary.  TSX-32 is an ideal process control or
  1819.          data collection system.
  1820.  
  1821.          TSX-32 is, quite simply, the best  and  most  powerful  operating
  1822.          system available for the 386 and 486.  For additional information
  1823.          contact:
  1824.                             S&H Computer Systems, Inc.
  1825.                               1027 17th Avenue South
  1826.                                 Nashville, TN 37212
  1827.                                615-327-3670 (voice)
  1828.                                 615-321-5929 (fax)
  1829.  
  1830.                 NONLIN -- Nonlinear Regression Program      Page 34
  1831.  
  1832.  
  1833.        =====================================================================
  1834.                                 Software Order Form
  1835.        =====================================================================
  1836.  
  1837.          Name ______________________________________________________
  1838.  
  1839.          Address ___________________________________________________
  1840.  
  1841.          City _______________________  State _______ Zip ___________
  1842.  
  1843.          Telephone _________________________________________________
  1844.  
  1845.          CompuServe account (optional) _____________________________
  1846.  
  1847.          Nonlin version ____________________________________________
  1848.  
  1849.          Bulletin board where you found Nonlin _____________________
  1850.  
  1851.          Comments __________________________________________________
  1852.  
  1853.          Check the box below which indicates your order type:
  1854.  
  1855.          ___ I wish to register Nonlin ($25).
  1856.  
  1857.          ___ I wish to order Mathplot ($20).
  1858.  
  1859.          ___ I wish to register Nonlin and order Mathplot ($40).
  1860.  
  1861.          Add $5 to any amount shown above if the software is being shipped
  1862.          out of the United States.
  1863.  
  1864.          In return for registering,  you  will  receive  the  most  recent
  1865.          version  of  the  program,  a  laser-printed,  bound  copy of the
  1866.          manual, and three months  of  telephone  or  CompuServe  support.
  1867.          Your  registration fee will be refunded if you find a serious bug
  1868.          that cannot be corrected.
  1869.  
  1870.          Distribution disk choice (check one):
  1871.  
  1872.                3.50" HD (1.4 MB)  ______
  1873.                5.25" HD (1.2 MB)  ______
  1874.                5.25" DD (360 KB)  ______
  1875.  
  1876.          Send this form with the amount indicated to the author:
  1877.  
  1878.                                 Phillip H. Sherrod
  1879.                                  4410 Gerald Place
  1880.                              Nashville, TN  37205-3806
  1881.                               615-292-2881 (evenings)
  1882.                                CompuServe: 71333,27
  1883.